package com.app.task;

import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;

public class WaitingTask extends Task {

	private AtomicInteger count = new AtomicInteger();
	private AtomicInteger target = new AtomicInteger();
	
	public int getTargetValue() {
		return target.get();
	}
	public void setTargetValue(int count) {
		this.target.set(count);
	}
	public void incrementCurrentValue(){
		count.incrementAndGet();
	}
	public void resetCurrentValue(){
		count.set(0);
	}
	@Override
	protected void task() {
		if(count.get() < target.get()){
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}else{
			taskComplete();
		}
	}
	
	

}
